package holiday_demo;

import java.util.Random;
import java.util.Scanner;

public class Num_random {
    public static void main(String[] args) {
        int num=new Random().nextInt(100);
        Scanner input=new Scanner(System.in);

        System.out.println("------------猜数字游戏-------------");


        while (true){
            System.out.println("输入你预测的数字！");
            int input_num= input.nextInt();
            if (input_num<num)
                System.out.println("小了，请重试！");
            else if(input_num>num)
                System.out.println("大了，请重试！");
            else {
                System.out.println("恭喜你，猜中了数字！");
                break;
            }
        }
    }
}
